<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>学生详情</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: "Microsoft YaHei", Arial, sans-serif;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            min-height: 100vh;
            padding: 20px;
        }

        .container {
            max-width: 800px;
            margin: 0 auto;
            background: white;
            border-radius: 10px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
            padding: 30px;
        }

        h1 {
            text-align: center;
            color: #333;
            margin-bottom: 30px;
            font-size: 28px;
        }

        .detail-card {
            background: #f8f9fa;
            border-radius: 8px;
            padding: 20px;
            margin-bottom: 20px;
        }

        .detail-row {
            display: flex;
            padding: 15px 0;
            border-bottom: 1px solid #e0e0e0;
        }

        .detail-row:last-child {
            border-bottom: none;
        }

        .detail-label {
            font-weight: bold;
            color: #555;
            width: 150px;
            flex-shrink: 0;
        }

        .detail-value {
            color: #333;
            flex: 1;
        }

        .btn-container {
            margin-top: 30px;
            text-align: center;
        }

        .btn {
            display: inline-block;
            padding: 10px 30px;
            margin: 0 10px;
            background: #667eea;
            color: white;
            text-decoration: none;
            border-radius: 5px;
            transition: background 0.3s;
            border: none;
            cursor: pointer;
            font-size: 14px;
        }

        .btn:hover {
            background: #5568d3;
        }

        .btn-secondary {
            background: #6c757d;
        }

        .btn-secondary:hover {
            background: #5a6268;
        }

        .btn-warning {
            background: #f39c12;
        }

        .btn-warning:hover {
            background: #e67e22;
        }
    </style>
</head>
<body>
    <div class="container">
        <h1>学生详细信息</h1>

        <c:if test="${not empty student}">
            <div class="detail-card">
                <div class="detail-row">
                    <div class="detail-label">记录ID：</div>
                    <div class="detail-value">${student.id}</div>
                </div>
                <div class="detail-row">
                    <div class="detail-label">身份证号：</div>
                    <div class="detail-value">${student.pId}</div>
                </div>
                <div class="detail-row">
                    <div class="detail-label">学号：</div>
                    <div class="detail-value">${student.no}</div>
                </div>
                <div class="detail-row">
                    <div class="detail-label">姓名：</div>
                    <div class="detail-value">${student.name}</div>
                </div>
                <div class="detail-row">
                    <div class="detail-label">性别：</div>
                    <div class="detail-value">${student.sex}</div>
                </div>
                <div class="detail-row">
                    <div class="detail-label">出生日期：</div>
                    <div class="detail-value">
                        <fmt:formatDate value="${student.birthdate}" pattern="yyyy-MM-dd"/>
                    </div>
                </div>
            </div>

            <div class="btn-container">
                <a href="${pageContext.request.contextPath}/student?action=edit&id=${student.id}" class="btn btn-warning">修改信息</a>
                <a href="${pageContext.request.contextPath}/student?action=list" class="btn btn-secondary">返回列表</a>
            </div>
        </c:if>

        <c:if test="${empty student}">
            <div style="text-align: center; padding: 40px; color: #999;">
                未找到学生信息
            </div>
            <div class="btn-container">
                <a href="${pageContext.request.contextPath}/student?action=list" class="btn btn-secondary">返回列表</a>
            </div>
        </c:if>
    </div>
</body>
</html>

